
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 12/18/2012 21:31:50
-- Generated from EDMX file: D:\proyectos\flexit\Loteria1026\Servidor\DbModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbModelStoreContainer].[FK_Dias_0]', 'F') IS NOT NULL
    ALTER TABLE [dbModelStoreContainer].[Dias] DROP CONSTRAINT [FK_Dias_0];
GO

-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbModelStoreContainer].[Dias]', 'U') IS NOT NULL
    DROP TABLE [dbModelStoreContainer].[Dias];
GO
IF OBJECT_ID(N'[dbModelStoreContainer].[Juego]', 'U') IS NOT NULL
    DROP TABLE [dbModelStoreContainer].[Juego];
GO
IF OBJECT_ID(N'[dbModelStoreContainer].[Textos]', 'U') IS NOT NULL
    DROP TABLE [dbModelStoreContainer].[Textos];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'Dias'
CREATE TABLE [dbo].[Dias] (
    [IdDias] integer  NOT NULL,
    [Dia] integer  NOT NULL,
    [Juego_IdJuego] integer  NOT NULL
);
GO

-- Creating table 'Juego'
CREATE TABLE [dbo].[Juego] (
    [IdJuego] integer  NOT NULL,
    [Nombre] nvarchar(2147483647)  NOT NULL,
    [HoraCierre] datetime  NULL,
    [Pozo] real  NULL,
    [Ganadores] nvarchar(2147483647)  NULL,
    [Aciertos] integer  NULL,
    [Precio] real  NULL,
    [Fecha] datetime  NULL,
    [Tipo] integer  NULL
);
GO

-- Creating table 'Textos'
CREATE TABLE [dbo].[Textos] (
    [IdTextos] integer  NOT NULL,
    [Texto] nvarchar(2147483647)  NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [IdDias] in table 'Dias'
ALTER TABLE [dbo].[Dias]
ADD CONSTRAINT [PK_Dias]
    PRIMARY KEY CLUSTERED ([IdDias] ASC);
GO

-- Creating primary key on [IdJuego] in table 'Juego'
ALTER TABLE [dbo].[Juego]
ADD CONSTRAINT [PK_Juego]
    PRIMARY KEY CLUSTERED ([IdJuego] ASC);
GO

-- Creating primary key on [IdTextos] in table 'Textos'
ALTER TABLE [dbo].[Textos]
ADD CONSTRAINT [PK_Textos]
    PRIMARY KEY CLUSTERED ([IdTextos] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [Juego_IdJuego] in table 'Dias'
ALTER TABLE [dbo].[Dias]
ADD CONSTRAINT [FK_Dias_0]
    FOREIGN KEY ([Juego_IdJuego])
    REFERENCES [dbo].[Juego]
        ([IdJuego])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_Dias_0'
CREATE INDEX [IX_FK_Dias_0]
ON [dbo].[Dias]
    ([Juego_IdJuego]);
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------